package com.liaoban.app.ui.anchor;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.liaoban.app.adapter.GiftAdapter;
import com.liaoban.app.api.type.Gift;
import com.liaoban.app.api.type.request.GiftRequest;
import com.liaoban.app.biz.CommonBiz;
import com.liaoban.app.constants.Constant;
import com.liaoban.app.constants.ExtraParam;
import com.liaoban.app.ui.base.BaseListActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ybc on 2018/7/30 0030.
 * 礼物
 */
public class GiftActivity extends BaseListActivity<Gift> {
    private String mWuserId;

    public static Intent newIntent(Context context, String wuserId) {
        Intent intent = new Intent(context, GiftActivity.class);
        intent.putExtra(ExtraParam.ID, wuserId);
        return intent;
    }

    @Override
    public String getNewTitle() {
        return "收到礼物";
    }

    @Override
    public BaseQuickAdapter getAdapter() {
        return new GiftAdapter(null);
    }

    @Override
    public void itemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int position) {

    }

    @Override
    public void itemClick(BaseQuickAdapter baseQuickAdapter, View view, int position) {

    }

    @Override
    public void getData() {
        GiftRequest giftRequest = new GiftRequest();
        giftRequest.setWuserId(mWuserId);
        giftRequest.setListrows(Constant.PAGE_SIZE + "");
        giftRequest.setPage(getPageIndex() + "");
        startTask(CommonBiz.getInstance().wuserGiftList(giftRequest), listBaseResponse -> {
            doSuc(listBaseResponse.data, listBaseResponse.totalPageCount);
        });
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        mWuserId = getIntent().getStringExtra(ExtraParam.ID);
        super.initView(savedInstanceState);
    }
}
